
package controllers;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JOptionPane;
import model.ComplaintModel;
import model.TaarifModel;
import model.TaarifRequestModel;
import view.ComplaintDetailsGUI;
import view.FeedbackHistoryDetailsGUI;
import client.CliMessage;


		/**
		 * This Class is a Feedback History Details Controller which  extends AbstractController 
		 * @author Tal & 
		 *
		 */

		public class FeedbackHistoryDetailsController extends AbstractController 
		{	
					private FeedbackHistoryDetailsGUI feedHisDetailsView;
					private ComplaintModel ComplaintModel;		
				
					/**
					 * This is FeedbackHistoryDetailsController controller constructor.
					 * @param feedHisDetailsView is a Feedback History Details Window instance.
					 * @param ComplaintModel is a Complaint Model instance.
					 */
					public FeedbackHistoryDetailsController(FeedbackHistoryDetailsGUI feedHisDetailsView, ComplaintModel complaintModel) 
					{
						super(feedHisDetailsView,complaintModel);
						this.feedHisDetailsView = feedHisDetailsView;
						this.ComplaintModel = complaintModel;
					}

					

					@Override
					public void handleDBRequestSuccess()
					{
					
						
					}
				
					
					
					@Override
					public void handleDBSearchResult(CliMessage dbResult) 
					{	
						//get a list of all unhendled complaints
						ArrayList<HashMap<String, String>> srs = dbResult.getSrs();
						
						
						String fname = null;
						String lname = null;
						
						   Map<String, String> complaintTupple  = srs.get(0);	
						   
						
						   System.out.println("com id:"+ComplaintModel.getComID()+""+"Details:"+complaintTupple.get("DETAILS")+" "+"Reply:"+complaintTupple.get("REPLY"));
						 //initialzie Complaint
						  ComplaintModel.setDetails(complaintTupple.get("DETAILS"));
						  ComplaintModel.setReply(complaintTupple.get("REPLY"));		
					
						
						///set fields GUi
					    feedHisDetailsView.setComplaintReplayArea(ComplaintModel.getReply());
						feedHisDetailsView.setComplaintDetArea(ComplaintModel.getDetails());
						
               			//display main window
						feedHisDetailsView.setVisible(true);	
					}

					@Override
					public void handleNullSearchResult() 
					{
						
						
					}


}
